<?php

ini_set('display_errors', 1);
error_reporting(-1);
require_once '/data/wwwroot/g_vendor/autoload.php';

use EasyWeChat\Factory;
$config = [
    'app_id' => 'wx65c35294aee7e410',
    'secret' => 'fab6bca6ff91ae5a72a5da0c2fd6d22a'
];

return true;
$app = Factory::miniProgram($config);
$roomIds = [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    9,
    10,
    11,
    12,
    13,
    14,
    15,
    19,
    20,
    21
];
foreach ($roomIds as $roomId) {
    $response = $app->app_code->getQrCode('pages/spaceDetail/spaceDetail?room_id=' . $roomId);
    if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
        $filename = $response->saveAs('./', $roomId . 'qrcode.png');
    }
}

